Page({
  data: {
    fei: 0,
    feiban: 0,
    num: false
  },
  formsubmit(e) {
    let num = this.data.num
    let bd = Number(e.detail.value.property)
    let fei = 0
    let feiban = 0
    if (bd < 10000) {
      fei = 50
    } else if (bd <= 100000) {
      fei = (bd - 10000) * 0.025 + 50
    } else if (bd > 100000 && bd <= 200000) {
      fei = (bd - 100000) * 0.02 + 50 + ((100000 - 10000) * 0.025)
    } else if (bd > 200000 && bd <= 500000) {
      fei = (bd - 200000) * 0.015 + 50 + ((100000 - 10000) * 0.025) + (200000 - 100000) * 0.02
    } else if (bd > 500000 && bd <= 1000000) {
      fei = (bd - 500000) * 0.01 + 50 + (100000 - 10000) * 0.025 + (200000 - 100000) * 0.02 + (500000 - 200000) * 0.015
    } else if (bd > 1000000 && bd <= 2000000) {
      fei = (bd - 1000000) * 0.009 + 50 + (100000 - 10000) * 0.025 + (200000 - 100000) * 0.02 + (500000 - 200000) * 0.015 + (1000000 - 500000) * 0.01
    } else if (bd > 2000000 && bd <= 5000000) {
      fei = (bd - 2000000) * 0.008 + 50 + (100000 - 10000) * 0.025 + (200000 - 100000) * 0.02 + (500000 - 200000) * 0.015 + (1000000 - 500000) * 0.01 + (2000000 - 1000000) * 0.009
    } else if (bd > 5000000 && bd <= 10000000) {
      fei = (bd - 5000000) * 0.007 + 50 + (100000 - 10000) * 0.025 + (200000 - 100000) * 0.02 + (500000 - 200000) * 0.015 + (1000000 - 500000) * 0.01 + (2000000 - 1000000) * 0.009 + (5000000 - 2000000) * 0.008
    } else if (bd > 10000000 && bd <= 20000000) {
      fei = (bd - 10000000) * 0.006 + 50 + (100000 - 10000) * 0.025 + (200000 - 100000) * 0.02 + (500000 - 200000) * 0.015 + (1000000 - 500000) * 0.01 + (2000000 - 1000000) * 0.009 + (5000000 - 2000000) * 0.008 + (10000000 - 5000000) * 0.007
    } else if (bd > 20000000) {
      fei = (bd - 20000000) * 0.005 + 50 + (100000 - 10000) * 0.025 + (200000 - 100000) * 0.02 + (500000 - 200000) * 0.015 + (1000000 - 500000) * 0.01 + (2000000 - 1000000) * 0.009 + (5000000 - 2000000) * 0.008 + (10000000 - 5000000) * 0.007 + (20000000 - 10000000) * 0.006
    }
    console.log(num)
    if (num == true) {
      fei *= 2
    } else if (num == false) {
      fei / 2
    }
    feiban = fei / 2
    fei = fei.toFixed(2)
    feiban = feiban.toFixed(2)
    this.setData({
      fei,feiban
    })
  },
  switchchange(e) {
    let fei = Number(this.data.fei)
    let feiban = fei / 2
    let alien=e.detail.value
    if(alien==true){
          fei *= 2
          feiban *= 2
    }else{
          fei /= 2
          feiban /= 2
    }

    // if (e.detail.value) {
    //   this.setData({
    //     num: true
    //   })
    //   fei *= 2
    //   feiban *= 2
    // } else if(!e.detail.value){
    //   this.setData({
    //     num: false
    //   })
    //   fei /= 2
    //   feiban /= 2
    // }

    this.setData({
      fei: fei.toFixed(2),
      feiban: feiban.toFixed(2)
    })
  }
})